﻿using Anke.SHManage.MSSQLDAL;
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Anke.SHManage.Web.Reports
{
    //2016-7-8 zch add
    public partial class PrintReChargeModeWebForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Data_Binding();
            }
        }
        private void Data_Binding()
        {
            string taskCode = Request.QueryString["TaskCode"];
            int patientOrder = Convert.ToInt32(Request.QueryString["PatientOrder"]);
            string isYB = Request.QueryString["IsYB"];  //add2021-10-15 plq 医保上线
            string isGJM = Request.QueryString["IsGJM"]; //add2022-03-28 plq 医保国家码上线
            if (isYB == "3")//有医保交易的重打发票 
            {
                this.ReportViewer1.LocalReport.DataSources.Clear();
                this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/PrintPatientReChargeYB.rdlc");
                M_PatientChargeDAL dal4 = new M_PatientChargeDAL();
                DataTable dt7 = dal4.getReChargePrint(taskCode, patientOrder);
                this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt7));
                this.ReportViewer1.LocalReport.Refresh();
            }
            else if (isGJM == "2") //有医保国家码交易
            {
                this.ReportViewer1.LocalReport.DataSources.Clear();
                this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/PrintPatientReChargeYB.rdlc");
                M_PatientChargeDAL dal4 = new M_PatientChargeDAL();
                DataTable dt7 = dal4.getReChargePrintGJM(taskCode, patientOrder);
                this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt7));
                this.ReportViewer1.LocalReport.Refresh();
            }
            else {
                this.ReportViewer1.LocalReport.DataSources.Clear();
                this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/PrintPatientReCharge.rdlc");
                M_PatientChargeDAL dal4 = new M_PatientChargeDAL();
                DataTable dt7 = dal4.getReChargePrint(taskCode, patientOrder);
                this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt7));
                this.ReportViewer1.LocalReport.Refresh();
            }
         
        }
    }
}